const express=require('express');
const http = require('http')
const app=express();
app.listen(9090,()=>{
  console.log('9090♥ ♥ ♥接口服务器启动成功')
})
app.all('*',(req,res,next)=>{
  res.header('Access-Control-Allow-Origin','*')
  next()
})
//post传参解析
app.use(express.urlencoded({
  extended:false
}))
//引入路由
const userRouter=require('./router/user')
app.use('/user',userRouter)
//错误处理中间件
app.use((err,req,res,next)=>{
  console.log(err)
  res.status(500).send({
    "code":500,
    "msg":"服务器端错误"
  })
})